package com.station.administrators.service.impl;

import com.station.administrators.dao.StationDao;
import com.open.capacity.common.model.StationModel;
import com.station.administrators.service.StationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author YangGang
 * @Description: TODO
 * @date 2021/6/25/9:59
 */
@Service
public class StationServiceImpl implements StationService {
    @Autowired
    private StationDao stationDao;

    @Override
    public void add(StationModel station) {
        stationDao.add(station);
    }

    @Override
    public void update(StationModel station) {
        stationDao.update(station);
    }

    @Override
    public void delete(Long id) {
        stationDao.delete(id);
    }

    @Override
    public StationModel findById(Long id) {
        return stationDao.findById(id);
    }

    @Override
    public List<StationModel> findAll(StationModel station) {
        Integer page = station.getPage();
        Integer limit = station.getLimit();
        page=(page-1)*limit;
        station.setPage(page);
        return stationDao.findAll(station);
    }

    @Override
    public Integer getCount(StationModel station) {
        return stationDao.getCount(station);
    }

    @Override
    public void updateStatus(StationModel station) {
        stationDao.updateStatus(station);
    }
}
